home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / patch / WHDIGamesS-T.lzh / ScoobyDoo.lha / WHD_ScoobyDoo / Install < prev    next >
Text File  |  2001-05-29  |  7KB  |  298 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Scooby and Scrappy Doo")
  5. (set #CFG_APPSLV  "SDHD")
  6. (set #CFG_APPGUI  "Scooby Doo")
  7. (set #CFG_APPVER  "R0501.1")
  8. (set #CFG_APPCOPY "2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             (working "Determining game version")
  58.  
  59.             (set #VT1 (getsum #VDATFILE))
  60.  
  61.             (set #VVERINFA 0)
  62.             (if (= #VT1 1104626703) (set #VVERINFA 1))
  63.         ))
  64.     ))
  65.  
  66.     (if (<> 1 (exists (tackon #VDATDIR "end.raw"))) (set #VVERINFA -1))
  67. ))
  68.  
  69. ;------------------------------------------------------------------------------------
  70. ; Make game data
  71. ;
  72. (procedure P_InstallGame (
  73.     ;
  74.     ; Set path to game data file
  75.     ;
  76.     (set #VDATFILE (tackon #VDATDIR "scrap.prg"))
  77.  
  78.     ;
  79.     ; Install data files if not found or unknown versions
  80.     ;
  81.     (P_SetVersionInfo)
  82.  
  83.     (if (<= #VVERINFA 0)(
  84.         ;
  85.         ; Tell user what is happening
  86.         ;
  87.         (message
  88.             (cat
  89.                 "\n\n\nThe installer will now create the game data files\n"
  90.                 "Plese insert your game disk into drive DF0:\n\n"
  91.                 "Click 'Proceed' when ready."
  92.             )
  93.         )
  94.  
  95.         ;
  96.         ; Call the extractor slave
  97.         ;
  98.         (working (cat "Creating data files in '" #VDATDIR "'"))
  99.  
  100.         (copyfiles
  101.             (prompt "Copying data file creation slave")
  102.             (help @copyfiles-help)
  103.             (source "ISlave")
  104.             (dest #VDESTDIR)
  105.             (nogauge)
  106.             (optional fail force)
  107.         )
  108.  
  109.         (set @execute-dir #VDESTDIR)
  110.         (run (cat "WHDLoad SLAVE=ISlave"))
  111.         (set @execute-dir #VOLDEXEDIR)
  112.  
  113.         (delete (tackon #VDESTDIR "ISlave") (optional force))
  114.     ))
  115.  
  116.     ;
  117.     ; Check the main data file was created and
  118.     ; that we know this version of the game
  119.     ;
  120.     (P_SetVersionInfo)
  121.  
  122.     (if (= 0 #VVERINFA)
  123.         (abort
  124.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  125.                     "The installer does not recognise the version of the\n"
  126.                     "game that you are trying to install.\n\n"
  127.                     "Please contact the author for further information\n"
  128.             )
  129.         )
  130.     )
  131.  
  132.     (if (= -1 #VVERINFA)
  133.         (abort
  134.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  135.                     "The installer could not extract the game data files.\n\n"
  136.                     "Please contact the author for further information\n"
  137.             )
  138.         )
  139.     )
  140. ))
  141.  
  142. ;------------------------------------------------------------------------------------
  143. ; Install WHDLoad slave program
  144.  
  145. (procedure P_InstallSlave (
  146.     (working "Installing slave program")
  147.  
  148.     ; copy slave program
  149.     (set #VT1 "Slave")
  150.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  151.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  152.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  153.  
  154.     (copyfiles
  155.         (prompt "Copying slave program")
  156.         (help @copyfiles-help)
  157.         (source #VT1)
  158.         (newname #CFG_APPSLV)
  159.         (dest #VDESTDIR)
  160.         (nogauge)
  161.         (optional fail force)
  162.     )
  163.  
  164.     ; copy GUI program if present
  165.     (if (= 1 (exists "GUI"))(
  166.         (copyfiles
  167.             (prompt "Copying GUI program")
  168.             (help @copyfiles-help)
  169.             (source  "GUI")
  170.             (newname #CFG_APPGUI)
  171.             (dest #VDESTDIR)
  172.             (nogauge)
  173.             (optional fail force)
  174.         )
  175.     ))
  176.  
  177.     ; see if the user wants or needs to install an icon
  178.  
  179.     (set #VT1 (cat #CFG_APPGUI ".info"))
  180.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  181.         ; no icon exists, quietly copy one in
  182.         (set #VT2 1)
  183.     )(
  184.         ; icon exists, ask user if they want to overwrite it
  185.         (set #VT2
  186.             (askbool
  187.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" icon (recommended) ?"))
  188.                 (default 1)
  189.                 (help @askchoice-help)
  190.             )
  191.         )
  192.     ))
  193.  
  194.     ; install the icon if required
  195.     (if (= 1 #VT2)(
  196.         ; get choice of icon format
  197.         (set #VT3
  198.             (askchoice
  199.                 (prompt "Which type of icon would you like to install?")
  200.                 (choices "Standard" "NewIcon" "OS3.5+ Coloricon")
  201.                 (help @askchoice-help)
  202.             )
  203.         )
  204.         (if (= 0 #VT3) (set #VT3 ".oi"))
  205.         (if (= 1 #VT3) (set #VT3 ".ni"))
  206.         (if (= 2 #VT3) (set #VT3 ".ci"))
  207.  
  208.         ; install the icon
  209.         (copyfiles
  210.             (prompt "Copying icon")
  211.             (help @copyfiles-help)
  212.             (source (cat "Icon" #VT3))
  213.             (newname #VT1)
  214.             (dest #VDESTDIR)
  215.             (nogauge)
  216.             (optional fail force)
  217.         )
  218.     ))
  219. ))
  220.  
  221. ;================================================================================
  222. ;
  223. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  224. ;
  225.  
  226. ;
  227. ; Initialise
  228. ;
  229. (set @app-name #CFG_APPNAME)
  230. (set #VOLDEXEDIR @execute-dir)
  231. (set #VVERINFA -1)
  232. (set #VVERINFB -1)
  233. (set #VVERINFC -1)
  234. (set #VDESTDIR @default-dest)
  235.  
  236. ;
  237. ; Check settings
  238. ;
  239. (if    (<> @user-level 2)
  240.     (abort "You must select 'Expert' user level")
  241. )
  242.  
  243. (if    (< @installer-version 2818051)
  244.     (abort "This product requires at least version 43.3 of the Installer program")
  245. )
  246.  
  247. ;
  248. ; Check required programs are available
  249. ;
  250. (set #VP1 "WHDLoad")
  251. (P_CheckRun)
  252.  
  253. ;
  254. ; Welcome message
  255. ;
  256. (message "\n\n\nWelcome to the " #CFG_APPNAME " HD Installer " #CFG_APPVER "\n\n"
  257.          "© " #CFG_APPCOPY " Halibut Software\n\n"
  258.          "Please read the documentation thoroughly "
  259.          "before attempting to use this installer!\n\n"
  260.          "Click 'Proceed' to begin..."
  261. )
  262.  
  263. ;
  264. ; Get directory to install in
  265. ;
  266. (set #VDESTDIR
  267.     (askdir
  268.         (prompt "Where would you like the game installed?\n"
  269.                 "If you have an existing installation select that directory,\n"
  270.                 "otherwise create / select the directory to install the game into."
  271.         )
  272.         (help @askdir-help)
  273.         (default @default-dest)
  274.         (disk)
  275.         (newpath)
  276.     )
  277. )
  278. (set #VDESTDIR (expandpath #VDESTDIR))
  279. (set @default-dest #VDESTDIR)
  280. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  281.  
  282. ;
  283. ; Create the installation directories
  284. ;
  285. (P_InstallDirs)
  286.  
  287. ;
  288. ; Install the game data
  289. ;
  290. (P_InstallGame)
  291.  
  292. ;
  293. ; Install the slave
  294. ;
  295. (P_InstallSlave)
  296.  
  297. ;============================================================================
  298. ;$VER: Scooby & Scrappy Doo Installer script R0501.1 © 2001 Halibut Software